<!-- 用户对应类型的案例汇总页面 -->
<template>
	<view class="case-type-sum-box">
		<!-- 循环渲染数据列表 -->
		<block v-for="caseItem in caseDataList" :key="caseItem.id">
			<view class="case-item-box" @click="caseItemClick(caseItem)">
				<text>{{ caseItem.title }}</text>
				<u-icon name="arrow-right" color="#999999"></u-icon>
			</view>
		</block>
	</view>
</template>

<script>
export default {
	data() {
		return {
			sortData: {
				page: 1,
				page_size: 999,
				type_id: '',
			},
			// 模拟数据列表
			caseDataList: []
		};
	},
	onLoad(options) {
		this.sortData.type_id = options.type_id
		this.getData()
		// 根据用户传递的参数动态设置页面标题
		uni.setNavigationBarTitle({
			title: options.case_name
		});
	},
	methods: {
		async getData() {
			const res = await this.$u.api.getJournalList(this.sortData)
			if(!res) return
			this.caseDataList = res
		},
		// 每条数据项的点击事件
		caseItemClick(caseData) {
			this.$u.vuex('vuex_caseData', caseData)
			this.$u.route('/myPackageA/pages/views/judgment-detail');
		}
	}
};
</script>

<style lang="scss" scoped>
.case-type-sum-box {
	background-color: #f5f5f5;
	min-height: 100vh;
	padding-top: 20rpx;
	.case-item-box {
		height: 92rpx;
		padding: 0 25rpx;
		font-size: 30rpx;
		background-color: white;
		font-family: PingFang SC;
		font-weight: 500;
		color: #141418;
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-bottom: 1rpx solid #ececec;
	}
}
</style>
